package com.wc.blue_bridge_history.Java14Q.G_奇怪的数;

import java.util.LinkedList;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/3/24 19:54
 * @description https://www.lanqiao.cn/paper/3874/problem/3528/
 */
public class Main {
    static int n, m;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        if (n <= 4 || m <= 3) {
            System.out.println(0);
            return;
        }
        dfs(n, 0, new LinkedList<>(), 0);
        System.out.println(res);
    }

    static long res = 0;

    static void dfs(int u, int sum, LinkedList<Integer> pre, int num) {
        if (sum > m) return;
        if (num == 5) {
            sum = sum - pre.getFirst();
            num = 4;
        }
        if (u == 0) {
//            System.out.println(pre);
            res++;
            return;
        }
        for (int i = u == n ? 1 : 0; i <= 9; i++) {
            if ((u & 1) == (i & 1)) {
                pre.add(i);
                dfs(u - 1, sum + i, pre, num + 1);
                pre.removeLast();
            }
        }
    }
}



